class Solution:
    def findMaxConsecutiveOnes(self, nums: 'List[int]') -> 'int':
        res = 0
        latest_start = 1
        nums.insert(0, 0)
        l = len(nums)

        for i in range(1, l):
            n = nums[i]
            if n == 1:
                if nums[i - 1] == 0:
                    latest_start = i
                    res = max(res, 1)
                if i >= l - 1 or nums[i + 1] == 0:
                    res = max(res, i - latest_start + 1)

        return res

s = Solution()
print(s.findMaxConsecutiveOnes([1, 1, 0, 1, 1, 1]))
